Classes
Position​
- C++
- Python
- Java
int get_x()
int get_y()
double distance_to(Position)
x: int
y : int
distance_to(Position): float
int getX()
int getY()
double distanceTo(Position other)
Attacker​
- C++
- Python
- Java
size_t get_hp()
size_t get_id()
size_t get_type()
Position get_position()
size_t is_ability_active
hp: int
id: int
type: AttackerType
position: Position
is_ability_active: int
int getId()
int getHp()
int getType()
Position getPosition()
int is_ability_active
Defender​
- C++
- Python
- Java
size_t get_hp()
size_t get_id()
size_t get_type()
Position get_position()
hp: int
id: int
type: DefenderType
position: Position
int getId()
int getHp()
int getType()
Position getPosition()
State​
- C++
- Python
- Java
const std::vector<Attacker>& get_attackers()
const std::vector<Defender>& get_defenders()
size_t get_turn_no()
size_t get_coins_left()
attackers: List[Attacker]
defenders: List[Defender]
turn_no: int
no_of_coins_left: int
List<Attacker> getAttackers()
List<Defender> getDefenders()
int getTurnNo()
int getCoinsLeft()
Game​
- C++
- Python
- Java
std::set<size_t> already_activated_attacker_ids
: Returns a set of attacker ids whose abilities have been activated till now. Its a static variable. Shouldnt be modified by the player , ideally a read only attributevoid spawn_attacker(size_t type_id, Position pos)
: Spawns Attacker of type type_id at Position posbool already_spawned_at_position(Position pos)
: Given a Position pos, it will return whether some attacker was already spawned in that position in the current turnvoid set_target(size_t attacker_id, size_t defender_id)
: Sets the target for Attacker with id=attacker_id as Defender with id=defender_id. If the defender_id is invalid, the simulator will handle that automatically and try to set the target which is at the nearest position to the Attackervoid activate_ability(size_t attacker_id)
: Activates the ability for the given attacker with id=attacker_id. If the attacker_id is invalid it does nothing.void set_target(const Attacker &attacker, const Defender &defender)
: Sets the target for Attacker(attacker) as Defender(defender). If the defender is invalid somehow, the simulator will handle that automatically and try to set the target which is at the nearest position to the Attackerstd::ostringstream &logr()
: Given a Game object(called game), you can dogame.logr()<<"Log This\n";
and it will be shown in the renderer logs when the game is being renderedconst std::unordered_map<size_t, size_t> &get_player_set_targets()
const std::vector<std::pair<size_t, Position>> &get_spawn_positions()
const std::set<Position> &get_already_spawned_positions() const
spawn_attacker(type_id: int, position: Position)
: Spawns Attacker of type type_id at Position posalready_activated_attacker_ids : set[int]
: Returns a set of attacker ids whose abilities have been activated till now. Its a static variable. Shouldnt be modified by the player , ideally a read only attributeis_already_spawned_at_position(position: Position): bool
: Given a Position pos, it will return whether some attacker was already spawned in that position in the current turnset_target(attacker_id: int, defender_id: int)
: Sets the target for Attacker with id=attacker_id as Defender with id=defender_id. If the defender_id is invalid, the simulator will handle that automatically and try to set the target which is at the nearest position to the Attackeractivate_ability(attacker_id:int)
: Activates the ability for Attacker with id=attacker_id. If the attacker_id is invalid it does nothing. throws an error if the id is not an int.log(line: str)
:Given a Game object(called game), you can dogame.log("Log This\n")
and it will be shown in the renderer logs when the game is being renderedclear_log()
player_set_targets: Dict[int, int]
spawn_positions: List[Tuple[int, Position]]
already_spawned_positions: Set[Position]
void spawnAttacker(int type_id, Position pos)
: Spawns Attacker of type type_id at Position posboolean alreadySpawnedAtPosition(Position pos)
: Given a Position pos, it will return whether some attacker was already spawned in that position in the current turnSet<Integer> already_activated_attacker_ids
: Returns a set of attacker ids whose abilities have been activated till now. Its a static variable. Shouldnt be modified by the player , ideally a read only attributevoid setTarget(int attacker_id, int defender_id)
: Sets the target for Attacker with id=attacker_id as Defender with id=defender_id. If the defender_id is invalid, the simulator will handle that automatically and try to set the target which is at the nearest position to the AttackeractivateAbility(int attacker_id)
: Activates the ability for Attacker with id=attacker_id. If the attacker_id is invalid it does nothing. throws an error if the id is not an int.void setTarget(Attacker attacker, Defender defender)
: Sets the target for Attacker(attacker) as Defender(defender). If the defender is invalid somehow, the simulator will handle that automatically and try to set the target which is at the nearest position to the Attackervoid log(String s)
Given a Game object(called game), you can dogame.log("Log This\n")
and it will be shown in the renderer logs when the game is being renderedvoid clearLog()
List<SpawnDetail> getSpawnPositions()
Map<Integer, Integer> getPlayerSetTargets()
AttackerType (Python Specific)​
hp: int
range: int
attack_power: int
price: int
speed: int
is_aerial: int
DefenderType (Python Specific)​
hp: int
range: int
attack_power: int
price: int
is_aerial: int
Attributes (C++ and Java Specific)​
This class stores the attributes for Attacker
and Defender
. This will be used as the value type in Constants for storing attributes of Attacker and Defender types.
- C++
- Java
unsigned hp
unsigned range
unsigned attackPower
unsigned speed
(to be ignored for Defender)unsigned price
unsigned is_aerial
unsigned weight
unsigned ability_activation_cost
int hp
int range
int attack_power
int speed
(to be ignored for Defender)int price
int is_aerial
unsigned weight
unsigned ability_activation_cost
SpawnDetail (Java Specific)​
int getTypeId()
: Returns the typeId of the spawnPosition getPos()
: Returns the position of the spawn